#include "selectServer.hpp"
#include "err.hpp"
#include <memory>
using namespace std;
using namespace select_cbr;

void Usage(std::string proc)
{
    std::cerr << "Usage:\n\t" << proc << "\n\n";
}

string translation(const string &req)
{
    string ans;
    for (auto x : req)
    {
        if (x >= 'a' && x <= 'z')
        {
            x -= 32;
        }
        ans += x;
    }
    return ans;
}
int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(USAGE_ERR);
    }
    unique_ptr<SelectServer> cbr(new SelectServer(translation, atoi(argv[1])));

    cbr->initServer();

    cbr->start();

    return 0;
}